Source for file SC_Customer.php
Documentation is available at SC_Customer.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
$sql_mobile = $mobile ? ' OR email_mobile = ?' : '';
$arrValues = array($email);
$sql = "SELECT * FROM dtb_customer WHERE (email = ?" . $sql_mobile . ") AND del_flg = 0 AND status = 2";
$objQuery = new SC_Query_Ex();
$result = $objQuery->getAll($sql, $arrValues);
// パスワードが合っていれば会員情報をcustomer_dataにセットしてtrueを返す
if ( SC_Utils_Ex::sfIsMatchHashPassword($pass, $data['password'], $data['salt']) ) {
* 配列の1番目に会員登録住所, 追加登録住所が存在する場合は2番目以降に
* @param integer $customer_id 顧客ID
* @return array 会員登録住所, 追加登録住所の配列
$objQuery = & SC_Query_Ex::getSingletonInstance();
( SELECT NULL AS other_deliv_id,
NULL AS email, NULL AS email_mobile,
NULL AS fax01, NULL AS fax02, NULL AS fax03
$objQuery->setOrder("other_deliv_id IS NULL DESC, other_deliv_id DESC");
return $objQuery->select("*", $from, "", array($customer_id, $customer_id));
* 携帯端末IDが一致する会員が存在するかどうかをチェックする。
* @return boolean 該当する会員が存在する場合は true、それ以外の場合
if(SC_MobileUserAgent_Ex::getCarrier() == 'docomo'){
if($_SESSION['mobile']['phone_id'] == "" && strlen($_SESSION['mobile']['phone_id']) == 0)
$_SESSION['mobile']['phone_id'] = SC_MobileUserAgent_Ex::getId();
if (!isset ($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) {
// 携帯端末IDが一致し、本登録された会員を検索する。
$sql = 'SELECT count(*) FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2';
$objQuery = new SC_Query_Ex();
$result = $objQuery->count("dtb_customer", "mobile_phone_id = ? AND del_flg = 0 AND status = 2", array($_SESSION['mobile']['phone_id']));
* 携帯端末IDを使用して会員を検索し、パスワードの照合を行う。
* パスワードが合っている場合は会員情報を取得する。
* @param string $pass パスワード
* @return boolean 該当する会員が存在し、パスワードが合っている場合は true、
if(SC_MobileUserAgent_Ex::getCarrier() == 'docomo'){
if($_SESSION['mobile']['phone_id'] == "" && strlen($_SESSION['mobile']['phone_id']) == 0)
$_SESSION['mobile']['phone_id'] = SC_MobileUserAgent_Ex::getId();
if (!isset ($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) {
// 携帯端末IDが一致し、本登録された会員を検索する。
$sql = 'SELECT * FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2';
$objQuery = new SC_Query_Ex();
@list ($data) = $objQuery->getAll($sql, array($_SESSION['mobile']['phone_id']));
// パスワードが合っている場合は、会員情報をcustomer_dataに格納してtrueを返す。
if ( SC_Utils_Ex::sfIsMatchHashPassword($pass, $data['password'], $data['salt']) ) {
if (!isset ($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) {
if ($this->customer_data['mobile_phone_id'] == $_SESSION['mobile']['phone_id']) {
$objQuery = new SC_Query_Ex();
$sqlval = array('mobile_phone_id' => $_SESSION['mobile']['phone_id']);
$where = 'customer_id = ? AND del_flg = 0 AND status = 2';
$objQuery->update('dtb_customer', $sqlval, $where, array($this->customer_data['customer_id']));
$this->customer_data['mobile_phone_id'] = $_SESSION['mobile']['phone_id'];
$sql = "SELECT * FROM dtb_customer WHERE (email = ? OR email_mobile = ?) AND del_flg = 0 AND status = 2";
$objQuery = new SC_Query_Ex();
$result = $objQuery->getAll($sql, array($email, $email));
$data = isset ($result[0]) ? $result[0] : "";
$sql = "SELECT * FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
$customer_id = $this->getValue('customer_id');
$objQuery = new SC_Query_Ex();
$arrRet = $objQuery->getAll($sql, array($customer_id));
// ログイン情報をセッションに登録し、ログに書き込む
GC_Utils_Ex::gfPrintLog("access : user=". $this->customer_data['customer_id'] . "\t". "ip=". $this->getRemoteHost(), CUSTOMER_LOG_REALFILE );
// ログアウト $_SESSION['customer']を解放し、ログに書き込む
// $_SESSION['customer']の解放
unset ($_SESSION['customer']);
SC_Helper_Session_Ex::destroyToken();
$objSiteSess = new SC_SiteSession_Ex();
$objSiteSess->unsetUniqId();
GC_Utils_Ex::gfPrintLog("logout : user=". $this->customer_data['customer_id'] . "\t". "ip=". $this->getRemoteHost(), CUSTOMER_LOG_REALFILE );
// ログイン時のメールアドレスとDBのメールアドレスが一致している場合
if(isset ($_SESSION['customer']['customer_id'])
&& SC_Utils_Ex::sfIsInt($_SESSION['customer']['customer_id'])) {
$objQuery = new SC_Query_Ex();
$email = $objQuery->get('email', "dtb_customer", "customer_id = ?", array($_SESSION['customer']['customer_id']));
if($email == $_SESSION['customer']['email']) {
// モバイルサイトの場合は携帯のメールアドレスが登録されていることもチェックする。
// ただし $dont_check_email_mobile が true の場合はチェックしない。
if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && !$dont_check_email_mobile) {
$email_mobile = $objQuery->get("email_mobile", "dtb_customer", "customer_id = ?", array($_SESSION['customer']['customer_id']));
return isset ($email_mobile);
if ($keyname == 'point') {
$objQuery = & SC_Query_Ex::getSingletonInstance();
$point = $objQuery->get('point', 'dtb_customer', 'customer_id = ?', array($_SESSION['customer']['customer_id']));
$_SESSION['customer']['point'] = $point;
return isset ($_SESSION['customer'][$keyname]) ? $_SESSION['customer'][$keyname] : "";
$_SESSION['customer'][$keyname] = $val;
if (isset ($_SESSION['customer'][$keyname])) {
return !SC_Utils_Ex::isBlank($_SESSION['customer'][$keyname]);
if (isset ($_SESSION['customer']['birth'])) {
$arrRet = preg_split("|[- :/]|", $_SESSION['customer']['birth']);
$birth_month = intval($arrRet[1]);
if($birth_month == $now_month) {
* $_SERVER['REMOTE_HOST'] または $_SERVER['REMOTE_ADDR'] を返す.
* $_SERVER['REMOTE_HOST'] が取得できない場合は $_SERVER['REMOTE_ADDR']
* @return string $_SERVER['REMOTE_HOST'] 又は $_SERVER['REMOTE_ADDR']の文字列
if (!empty($_SERVER['REMOTE_HOST'])) {
return $_SERVER['REMOTE_HOST'];
} elseif (!empty($_SERVER['REMOTE_ADDR'])) {
return $_SERVER['REMOTE_ADDR'];
$objQuery = new SC_Query_Ex();
$arrOrderSummary = $objQuery->getRow("SUM( payment_total ) as buy_total, COUNT(order_id) as buy_times,MAX( create_date ) as last_buy_date, MIN(create_date) as first_buy_date","dtb_order","customer_id = ? AND del_flg = 0 AND status <> ?",array($customer_id,ORDER_CANCEL));
$objQuery->update("dtb_customer",$arrOrderSummary,"customer_id = ?",array($customer_id));
Documentation generated on Fri, 24 Feb 2012 14:02:28 +0900 by Seasoft
|